package event.model;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Time implements Comparable<Time> {
	
	private long time;
	
	public Time(long time) {
		this.time = time;
	}
	
	public Time() {
		this.time = System.currentTimeMillis();
	}
	
	@Override
	public String toString() {
		Date d = new Date(time);
		SimpleDateFormat format = new SimpleDateFormat("d/M HH:mm");
		
		return format.format(d);
	}

	@Override
	public int compareTo(Time t) {
		long diff = (time - t.time);
		if (diff == 0)
			return 0;
		else if (diff < 0)
			return -1;
		else
			return 1;
	}	
}
